package com.example.administrator.myapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.myapplication.R;

/**
 * Created by Administrator on 2020/9/28.
 */

public class MeunAdapter extends BaseAdapter {
    private Context context;
    private String[] meunStrArray;

    public MeunAdapter(Context context, String[] meunStrArray) {
        this.context = context;
        this.meunStrArray = meunStrArray;
    }

    public MeunAdapter() {
    }

    @Override
    public int getCount() {
        return meunStrArray.length;
    }

    @Override
    public Object getItem(int position) {
        return meunStrArray[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView= View.inflate(context, R.layout.meun_item,null);
        TextView meunTitle = (TextView) convertView.findViewById(R.id.meun_lv_tv);
        meunTitle.setText(meunStrArray[position]+"");
        return convertView;
    }
}
